package Thread;
/**t1等待main*/
public class demo16 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();

        Thread t1 = new Thread(()->{
            try {
                System.out.println("开始等待main");
                mainThread.join();
                System.out.println("结束等待main");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();

        Thread.sleep(3000);
        System.out.println("main结束");
    }
}
